<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::get('/', function(){
    return 'api';
});

Route::group(['namespace'=>'Api'], function(){
    Route::get('/test', 'TestController@index');
});

Route::group(['namespace'=>'Api','middleware'=>['verifysign']], function(){
    Route::any('/event/tested/{order_id?}', 'EventController@tested');
    Route::post('/event/orderoffered/{order_id}', 'EventController@orderOffered');
    Route::post('/event/orderemployed/{trade_id}', 'EventController@orderEmployed');
    Route::post('/event/orderappointed/{order_id}', 'EventController@orderAppointed');
    Route::post('/event/orderfinished/{order_id}', 'EventController@orderFinished');
    Route::post('/event/ordersuccess/{order_id}', 'EventController@orderSuccess');
    Route::post('/event/masterorderrefund/{refund_id}', 'EventController@masterOrderRefund');
    Route::post('/event/orderevaluated/{refund_id}', 'EventController@orderEvaluated');
    Route::post('/event/merchantorderrefund/{refund_id}', 'EventController@merchantOrderRefund');
    Route::post('/event/merchantorderarbitrate/{refund_id}', 'EventController@merchantOrderArbitrate');
    Route::post('/event/merchantordercomplain/{complain_id}', 'EventController@merchantOrderComplain');
    Route::post('/event/masterassurefund/{fund_id}', 'EventController@masterAssureFund');
    Route::post('/event/merchantrecharge/{recharge_id}', 'EventController@merchantRecharge');
    Route::post('/event/couponassign/{merchant_id}/{coupon_id}/{count}', 'EventController@couponAssign');
    Route::post('/event/orderdelivered/{order_id}', 'EventController@orderDelivered');
});

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});
